import request from '@/utils/request'
import { makeFormData } from '@/utils/util'

export const api = {
  menuList: 'web/staff/platform_menus',
  roleList: 'web/staff/area_roles',
  menusByRole: 'web/staff/role_menus'
}

export function menuList (params = {}, method = 'get') {
  return request({
    url: api.menuList,
    method,
    params
  })
}

export function menusByRole (params = {}, data = {}, method = 'get') {
  return request({
    url: api.menusByRole,
    method,
    params,
    data: makeFormData(data)
  })
}

export function getRoles (params = {}) {
  return request({
    url: api.roleList,
    method: 'get',
    params
  })
}
